import { createContext, useEffect, useState } from "react";
import { useLocalStorageState } from 'ahooks';

export const LayoutContext = createContext(null);

export default function LayoutContextProvider({ children }) {
  const [layout, setLayout] = useLocalStorageState("layout", {
    defaultValue: {
      header: true,
      sidebar: true,
      issues: true,
      toolbar: true,
      fullscreen: false,
    },
  });

  return (
    <LayoutContext.Provider value={{ layout, setLayout }}>
      {children}
    </LayoutContext.Provider>
  );
}
